import axios from '@/plugins/axios'

// 查询可选择的用人单位树形结构
export async function selectTreeList (params) {
  try {
    let res = await axios.post(`/jobboard/settings/company/selectTreeList`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 查询可编辑的用人单位树形结构
export async function editList (params) {
  try {
    let res = await axios.post(`/jobboard/settings/company/editList`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 查询单个用人单位详细信息
export async function detail (params) { // 查询单个用人单位详细信息 *************
  try {
    let res = await axios.get(`/company/find`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 编辑用人单位
export async function updateCompany (params) { // 编辑用人单位 *************
  try {
    let res = await axios.post(`/company/create`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 启用/禁用用人单位
export async function updateStatus (params) {
  try {
    let res = await axios.post(`/jobboard/settings/company/updateStatus`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 新增用人单位
export async function saveCompany (params) {
  try {
    let res = await axios.post(`/jobboard/settings/company/save`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 删除用人单位
export async function deleteCompany (params) {
  try {
    let res = await axios.post(`/jobboard/settings/company/delete`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 用人单位统计
export async function count (params) {
  try {
    let res = await axios.post(`/jobboard/settings/company/count`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 获取现有职位、简历、账号等数量
export async function enterpriseCount (params) {
  try {
    let res = await axios.post(`/jobboard/positions/enterprise/enterpriseCount`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 上传图片
export async function uploadLogo (params) {
  try {
    let res = await axios.post(`/jobboard/settings/company/uploadLogo`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 查询用人单位模板
export async function findFieldGroups (params) { // 查询用人单位模板 ******
  try {
    let res = await axios.get(`/static/employingUnit/employingUnitTemplate.json`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 合并企业
export async function accountMerge (params) {
  try {
    let res = await axios.post(`/jobboard/employers/account/merge`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 撤销合并企业
export async function vendorCancelToJoin (params) {
  try {
    let res = await axios.post(`/jobboard/employers/account/vendorCancelToJoin`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 获取状态接口
export async function consolidate (params) {
  try {
    let res = await axios.post(`/jobboard/employers/account/consolidate`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 目标单位审核列表接口
export async function consolidateDetailByTarget (params) {
  try {
    let res = await axios.post(`/jobboard/employers/account/consolidateDetailByTarget`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 审核通过接口
export async function vendorApprove (params) {
  try {
    let res = await axios.post(`/jobboard/employers/account/vendorApprove`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 目标单位审核列表接口
export async function accountReject (params) {
  try {
    let res = await axios.post(`/jobboard/employers/account/reject`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
